package com.zs.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.zs.model.WorkOrderEntity;
import org.springframework.stereotype.Service;

import com.google.gson.Gson;
import com.zs.common.config.ResponseCode;
import com.zs.mapper.WorkOrderMapper;
import com.zs.model.ResponseCodeEntity;
import com.zs.model.criteria.BaseCriteria;
import com.zs.service.WorkOrderService;

/**
 * 
 * @author THINK
 *
 */
@Service("workOrderService")
public class WorkOrderServiceImpl implements WorkOrderService{

    @Resource
    private WorkOrderMapper workOrderMapper;
    
    @Resource
    private Gson gson;

    @Override
    public String selectWorkOrderList(BaseCriteria baseCriteria) {
    	List<WorkOrderEntity> workOrderList = workOrderMapper.selectWorkOrderList(baseCriteria);

    	ResponseCodeEntity responseCodeEntity =new ResponseCodeEntity(ResponseCode.DATA_OK,ResponseCode.DATA_SUCESS, workOrderList, workOrderList.size(), baseCriteria.getPageSize(), baseCriteria.getPageNo());
    	return gson.toJson(responseCodeEntity);
    }

	@Override
	public Integer saveWorkOrder(WorkOrderEntity workOrderEntity) {
		return workOrderMapper.saveWorkOrder(workOrderEntity);
	}


}
